<template>
	<view class="" style="position: relative;overflow: hidden;min-height: 100vh;">
		<image :src="ossUrl + `/static/sharecardbg.jpg`" class="boxbg"></image>
		<view class="more" @click="gomoregn">
			<image :src="ossUrl + `/static/gongnue.gif`" mode=""></image>
		</view>
		<view class="invitebtn">
			<text>马上邀请</text>
			<button open-type="share"></button>
		</view>
		<view class="contentboxbg">
			<view class="contentbox">
				<view class="c_title">· 我的邀请收益 ·</view>
				<view class="moneylist">
					<view class="moneyit">
						<text>已邀请</text>
						<view class=""><text>{{a}}</text>人 </view>
					</view>
					<view class="line"></view>
					<view class="moneyit">
						<text>{{one_price_min1}}-{{one_price_max2}}元</text>
						<view class=""><text>{{b}}</text>人 </view>
					</view>
					<view class="line"></view>
					<view class="moneyit">
						<text>{{two_price_min1}}-{{two_price_max2}}元</text>
						<view class=""><text>{{c}}</text>人 </view>
					</view>
					<view class="line"></view>
					<view class="moneyit">
						<text>总收益</text>
						<view class=""><text>{{incomeSum}}</text>元 </view>
					</view>
					<view class="line"></view>
					<view class="moneyit">
						<text>余额</text>
						<view class=""><text>{{balance}}</text>元 </view>
					</view>

				</view>
				<view class="wanttx" @click="open">我要提现</view>

				<view class="listbg">

					<view class="listitem" v-for="(item,index) in list" :key="index" @click="gocard(item.b_id)">
						<block v-if="item.nickname=='TA还没领取名片'">
							<image src="https://cos.dingquan.vip/wx-mini/static/avatar.png" mode=""></image>
							<view class="name">
								<text>TA还没领取名片</text>
								<text>{{item.add_time}}</text>
							</view>
							<view class="type" style="width: 260rpx;">教他领名片拿奖金</view>
                           <view class="jiangl" :style="(item.revenue?'':'opacity: 0;')+'color:#b86764;width: 100rpx;'">
                           	<text>{{item.revenue}}</text>人
                           </view>
						</block>
						<block v-else>
							<image :src="item.head" mode=""></image>
							<view class="name">
								<text class="type2">{{item.nickname}}</text>
								<text>{{item.add_time}}</text>
							</view>
							<view class="type">{{item.name}}</view>
							<view class="jiangl" :style="(item.revenue?'':'opacity: 0;')+'color:'+item.color">奖励
								<text>{{item.revenue}}</text>元
							</view>
							<view class="plus-one" v-if="item.look==0&&item.final_profit">+{{item.final_profit}}元</view>
						</block>

					</view>


				</view>

			</view>

		</view>

		<WithdrawalPopup ref="WithdrawalPopupRef" @reload="getIncome" />
		<view class="" style="height: 30rpx;"></view>
	</view>
</template>
<script>
	import WithdrawalPopup from '@/components/withdrawalPopup/withdrawalPopup.vue'
	import {
		makeMoney,
		InformationMyIncome
	} from '@/common/http/api.js'
	export default {
		components: {
			WithdrawalPopup,
		},
		data() {
			return {
				page: 1,
				top: 0,
				height: 0,
				a: 0,
				b: 0,
				c: 0,
				list: [],
				balance: 0,
				incomeSum: 0,
				one_price_max2: '',
				one_price_min1: '',
				two_price_max2: '',
				two_price_min1: '',

			}
		},
		created() {
			// 获取胶囊按钮的位置信息
			let menuButtonRect = wx.getMenuButtonBoundingClientRect();
			this.top = menuButtonRect.top
			this.height = menuButtonRect.height


		},

		onLoad() {
			this.getIncome()
			this.getTableList()
		},
		methods: {
			gocard(e){
				if(e){
					uni.navigateTo({
						url:"/pages/index/other?isBackHome=2&shareId="+e
					})
				}
			
			
			},
			getIncome() {
				InformationMyIncome().then(res => {
					this.balance = res.data.balance
					this.incomeSum = res.data.incomeSum
				})
			},


			getTableList() {

				uni.showLoading({
					mask: true
				})

				makeMoney().then(res => {
					uni.hideLoading()
					this.a = res.data.a
					this.b = res.data.b
					this.c = res.data.c


					this.one_price_max2 = res.data.one_price_max2
					this.one_price_min1 = res.data.one_price_min1
					this.two_price_max2 = res.data.two_price_max2
					this.two_price_min1 = res.data.two_price_min1


					this.list = res.data.list
				})

			},


			open() {
				this.$refs.WithdrawalPopupRef.show()

			},

			gomoregn() {
				uni.navigateTo({
					url: '/pagesA/aboutUs/aboutUs?id=46'
				})
			}

		}
	}
</script>

<style>
	page {
		background: rgb(255, 51, 1);
		/* overflow: hidden; */
	}
</style>
<style lang="scss" scoped>
	.plus-one {
		position: absolute;
		right: 20rpx;
		top: 50%;
		// transform: translate(0, -50%);
		
		color: #fb0000;
		font-weight: bold;
		opacity: 0;
		animation: fadeUp 2.5s ease-out forwards;
	}

	@keyframes fadeUp {
		0% {
			opacity: 1;
			transform: translate(0, -50%);
			font-size: 24rpx;
		}

		100% {
			opacity: 0;
			transform: translate(0, -200%);
			font-size: 48rpx;
		}
	}




	.listbg {
		width: 100%;
		margin-top: 30rpx;

		.listitem {
			height: 100rpx;
			box-sizing: border-box;
			padding-right: 20rpx;
			padding-left: 40rpx;

			display: flex;
			align-items: center;
			justify-content: space-between;
			position: relative;

			image {
				width: 68rpx;
				height: 68rpx;
				border-radius: 50%;
			}

			.type {
				width: 190rpx;
				text-align: center;
				font-size: 28rpx;
				color: #CECBC6;

			}

			.jiangl {
				width: 190rpx;
				text-align: right;
				font-size: 26rpx;
				font-weight: bold;
				white-space: nowrap;
				position: relative;

				text {
					font-size: 32rpx;
				}
			}

			.name {
				margin-left: 10rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				font-size: 26rpx;
				color: #333;
				font-weight: 500;
				width: 210rpx;

				text:nth-of-type(1) {
					display: block;

					width: 200rpx;
					text-align: center;
					font-weight: bold;
				}

				.type2 {
					text-overflow: ellipsis;
					white-space: nowrap;
					overflow: hidden;
				}

				text:nth-of-type(2) {
					color: #666;
					font-size: 22rpx;
				}
			}
		}

		.listitem:nth-of-type(odd) {
			background: rgb(246, 243, 238);
		}
	}




	.wanttx {
		width: 350rpx;
		height: 64rpx;
		background: linear-gradient(to right, rgb(243, 139, 50), rgb(252, 91, 63));
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		font-size: 28rpx;
		border-radius: 32rpx;
		font-weight: bold;
		margin-top: 30rpx;
	}

	.boxbg {
		position: absolute;
		width: 750rpx;
		height: 1333rpx;
		left: 0;
		top: 0;
	}

	.more {
		position: fixed;
		z-index: 999;
		right: 0;
		top: 400rpx;
		width: 160rpx;
		height: 160rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.invitebtn {
		button {
			position: absolute;
			z-index: 100;
			left: 0;
			top: 0;
			width: 570rpx;
			height: 100rpx;
			opacity: 0;
		}

		width: 570rpx;
		height: 100rpx;
		border-radius: 50rpx;
		background: linear-gradient(to bottom, rgb(249, 234, 47), rgb(255, 177, 4));
		position: relative;
		z-index: 99;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 552rpx;
		margin-left: 90rpx;
		letter-spacing: 4rpx;
		font-weight: bold;
		color: #333;
		font-size: 36rpx;
		box-shadow: 0 8rpx 4rpx rgb(230, 91, 8);
	}

	.contentboxbg {
		position: relative;
		z-index: 99;
		width: 734rpx;
		margin-left: 8rpx;
		background: rgb(255, 174, 67);
		margin-top: 30rpx;
		border-radius: 20rpx;
		box-sizing: border-box;
		overflow: hidden;

		.contentbox {
			background: #fff;
			width: 714rpx;
			margin: 10rpx;
			border-radius: 10rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			box-sizing: border-box;
			padding: 10rpx 0;

			.moneylist {
				margin-top: 30rpx;
				width: 100%;
				display: flex;
				align-items: center;

				.line {
					width: 1rpx;
					height: 90rpx;
					background: #666;
				}

				.moneyit {
					height: 90rpx;
					width: 20%;
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					align-items: center;
					font-size: 24rpx;

					&>text {
						color: rgb(106, 107, 102);
					}

					view {
						color: rgb(184, 103, 100);

						text {
							font-weight: bold;
							font-size: 30rpx;
						}
					}
				}
			}


			.c_title {
				width: 320rpx;
				height: 64rpx;
				background: rgb(254, 244, 219);
				font-weight: bold;
				color: #333;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 30rpx;
				color: rgb(178, 74, 63);
				border-radius: 0 0 50rpx 50rpx;
			}

		}
	}
</style>